]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Show warning indicator when unsafe-mode is on
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 2 Sep 2021 15:15:36 +0000 (17:15 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 3 Sep 2021 21:34:58 +0000 (21:34 +0000)
MetaContext added an unsafe-mode property, which we will use to restrict
a number of privileged operations unless it is enabled. It is meant to
only be enabled temporarily for development/debugging purposes, so add
a scary icon to the top bar as a reminder to turn it off again.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>

js/ui/panel.js

index 89b082ad05f86c68b928e931a22243ff3486dce7..dafba690a57075d293201cf919d15c02451d0d9e 100644 (file)
@@ -507,6 +507,20 @@ class PanelCorner extends St.DrawingArea {
     }
 });
 
+const UnsafeModeIndicator = GObject.registerClass(
+class UnsafeModeIndicator extends PanelMenu.SystemIndicator {
+    _init() {
+        super._init();
+
+        this._indicator = this._addIndicator();
+        this._indicator.icon_name = 'channel-insecure-symbolic';
+
+        global.context.bind_property('unsafe-mode',
+            this._indicator, 'visible',
+            GObject.BindingFlags.SYNC_CREATE);
+    }
+});
+
 var AggregateLayout = GObject.registerClass(
 class AggregateLayout extends Clutter.BoxLayout {
     _init(params = {}) {
@@ -568,6 +582,7 @@ class AggregateMenu extends PanelMenu.Button {
         this._location = new imports.ui.status.location.Indicator();
         this._nightLight = new imports.ui.status.nightLight.Indicator();
         this._thunderbolt = new imports.ui.status.thunderbolt.Indicator();
+        this._unsafeMode = new UnsafeModeIndicator();
 
         this._indicators.add_child(this._remoteAccess);
         this._indicators.add_child(this._thunderbolt);
@@ -579,6 +594,7 @@ class AggregateMenu extends PanelMenu.Button {
             this._indicators.add_child(this._bluetooth);
         this._indicators.add_child(this._rfkill);
         this._indicators.add_child(this._volume);
+        this._indicators.add_child(this._unsafeMode);
         this._indicators.add_child(this._power);
         this._indicators.add_child(this._powerProfiles);